<!-- target: shoppingCouponForm(master = formPage) -->
<!-- block: crumb -->
    <!-- import: shoppingCouponFormCrumb -->
<!-- /block -->
<!-- block: formMain -->
    <!-- import: shoppingCouponFormMain -->
<!-- /block -->

<!-- target: shoppingCouponFormCrumb(master = crumb) -->
<!-- block: path -->
    <span>优惠</span>
    <span><!-- if: ${formType} === 'create' -->新增<!-- else: -->编辑<!-- /if -->优惠</span>
<!-- /block -->

<!-- target: shoppingCouponFormMain(master = customFormView) -->
<!-- block: sections -->
    <!-- import: shoppingCouponBaseContent -->
<!-- /block -->
<!-- block: submitSection -->
<button type="submit" data-ui-type="Button" data-ui-id="submit" data-ui-group="submit" data-ui-variants="warning wide" class="submit-button">确认提交</button>
<!-- /block -->

<!-- target: shoppingCouponBaseContent -->
<section class="form-section">

    <div class="ui-form-row">
        <!-- use:
            textboxField(
                field = 'title',
                title = '优惠主题',
                width = 300,
                required = true
            )
        -->
    </div>

    <div class="ui-form-row">
        <!-- use:
            timeField(
                dateField = 'startDate', timeField = 'startTime',
                title = '开始时间', required = true, timeList = ${timeList}
            )
        -->
    </div>

    <div class="ui-form-row">
        <!-- use:
            timeField(
                dateField = 'endDate', timeField = 'endTime',
                title = '结束时间', required = true, timeList = ${timeList}
            )
        -->
    </div>

    <div class="ui-form-row">
        <!-- use:
            textboxField(
                field = 'phone',
                title = '电话',
                width = 150
            )
        -->
    </div>

    <div class="ui-form-row">
        <!-- use:
            textboxField(
                field = 'price',
                title = '现价',
                width = 120,
                required = true
            )
        -->
    </div>

    <div class="ui-form-row">
        <!-- use:
            textboxField(
                field = 'oldPrice',
                title = '原价',
                width = 120,
                required = true
            )
        -->
    </div>

    <div class="ui-form-row">
        <!-- use:
            textboxField(
                field = 'content',
                title = '优惠详情', 
                width = 300,
                height = 160,
                mode = 'textarea'
            )
        -->
    </div>

    <!-- use:
        commonTip(
            system = ${system},
            hasSpecialTimeSpan = true,
            hasBookInfo = true,
            hasInvoiceTip = true,
            hasSpecialTip = true
        )
    -->

    <div class="ui-form-row">
        <!-- use:
            shoppingCouponProducts(
                field = 'benefits',
                title = '优惠商品',
                benefitsChecked = ${benefitsChecked},
                uploadUrl = ${uploadUrl}
            )
        -->
    </div>

</section>

<!-- target: shoppingCouponProducts(master = formLabelValueField) -->
<!-- block: value -->
    <div data-ui-type="CheckboxPanel" data-ui-id="benefits-checkbox-panel" data-ui-expanded="${benefitsChecked}">
        <div class="ui-checkbox-custom">
            <input id="${field}-benefits" type="checkbox" value="benefits" />
            <label for="${field}-benefits">有</label>
        </div>
        <div>
            <!-- use:
                uploaderWithPriceImageList(
                    field = 'products',
                    title = '商品',
                    imageWidth = 250,
                    uploadUrl = ${uploadUrl},
                    required = true,
                    multiple = true,
                    descriptions = ['单张图片大小不超过500k']
                )
            -->
        </div>
    </div>
<!-- /block -->

<!-- target: uploaderWithPriceImageList -->
<!-- var: name = ${name} || ${field} -->
<!-- var: id = ${id} || ${name} -->
<!-- var: text = ${text} || ('上传' + ${title}) -->
<esui-uploader
    data-ui-id="${id | dasherize}-uploader"
    data-ui-text="${text}"
    data-ui-action="${uploadUrl}"
    data-ui-accept='.gif,.jpg,.png'
    data-ui-param-key='filename'
    <!-- if: ${multiple} -->data-ui-multiple="true"<!-- /if -->
    data-ui-progress-container="${id}-message-container"
></esui-uploader>
<div id="${id}-message-container"></div>
<!-- if: ${descriptions} && ${descriptions.length} > 0 -->
<ul class="uploader-desc">
    <!-- for: ${descriptions} as ${desc}, ${index} -->
    <!-- var: index = ${index} + 1 -->
    <li>${index}. ${desc}</li>
    <!-- /for -->
</ul>
<!-- /if -->
<esui-price-image-list 
    data-ui-id="${id | dasherize}-preview"
    data-ui-name="${name}"
    data-ui-raw-value="@${field}"
    <!-- if: ${imageWidth} -->data-ui-image-width="${imageWidth}"<!-- /if -->
></esui-price-image-list>
